700 |
How can I filter the check-boxes (method 1)
with Grid1 do begin with (IUnknown(Columns.Add('Check')) as EXGRIDLib_TLB.Column) do begin with Editor do begin EditType := EXGRIDLib_TLB.CheckValueType; Option[EXGRIDLib_TLB.exCheckValue2] := OleVariant(1); end; DisplayFilterButton := True; DisplayFilterPattern := False; FilterType := EXGRIDLib_TLB.exCheck; end; with Items do begin AddItem(OleVariant(True)); AddItem(OleVariant(True)); AddItem(OleVariant(False)); AddItem(OleVariant(True)); AddItem(OleVariant(False)); AddItem(OleVariant(True)); AddItem(OleVariant(False)); end; end |
699 |
How can add a button to control
// ButtonClick event - Occurs when user clicks on the cell's button. procedure TForm1.Grid1ButtonClick(ASender: TObject; Item : HITEM;ColIndex : Integer;Key : OleVariant); begin with Grid1 do begin OutputDebugString( 'ButtonClick' ); OutputDebugString( Items.CellCaption[OleVariant(Item),OleVariant(ColIndex)] ); OutputDebugString( Key ); end end; with Grid1 do begin BeginUpdate(); DefaultItemHeight := 22; HeaderHeight := 22; Appearance := EXGRIDLib_TLB.None2; DrawGridLines := EXGRIDLib_TLB.exRowLines; ScrollBySingleLine := False; Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' + 'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' + 'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' + 'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA='); HTMLPicture['pic1'] := 'c:\exontrol\images\auction.gif'; with Columns do begin with (IUnknown(Add('Type')) as EXGRIDLib_TLB.Column) do begin Width := 48; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; with (IUnknown(Add('Appearance')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Alignment := EXGRIDLib_TLB.CenterAlignment; HeaderAlignment := EXGRIDLib_TLB.CenterAlignment; end; end; with Items do begin h := AddItem('Items.<b>CellHasButton</b> property'); CellValue[OleVariant(h),OleVariant(1)] := 'Button <b>1</b>'; CellHasButton[OleVariant(h),OleVariant(1)] := True; h := AddItem('Items.<b>CellButtonAutoWidth</b> property'); CellValue[OleVariant(h),OleVariant(1)] := ' Button <b>2</b> '; CellHasButton[OleVariant(h),OleVariant(1)] := True; CellButtonAutoWidth[OleVariant(h),OleVariant(1)] := True; h := AddItem('Items.<b>CellHasButton</b> property'); CellValue[OleVariant(h),OleVariant(1)] := ' <img>2</img>Button <b>3</b> '; CellHasButton[OleVariant(h),OleVariant(1)] := True; CellButtonAutoWidth[OleVariant(h),OleVariant(1)] := True; h := AddItem('Items.<b>CellHasButton</b> property'); ItemHeight[h] := 32; CellValue[OleVariant(h),OleVariant(1)] := ' <img>2</img>Button <b>4</b> <img>pic1</img> '; CellHasButton[OleVariant(h),OleVariant(1)] := True; CellButtonAutoWidth[OleVariant(h),OleVariant(1)] := True; h := AddItem('Items.<b>CellHasButton</b> in splitted cells'); CellValue[OleVariant(h),OleVariant(1)] := ' Button <b>5.1</b> '; CellHasButton[OleVariant(h),OleVariant(1)] := True; CellButtonAutoWidth[OleVariant(h),OleVariant(1)] := True; s := SplitCell[OleVariant(h),OleVariant(1)]; CellValue[OleVariant(0),OleVariant(s)] := ' Button <b>5.2</b> '; CellHasButton[OleVariant(0),OleVariant(s)] := True; CellButtonAutoWidth[OleVariant(0),OleVariant(s)] := True; h := AddItem('Column.<b>Editor</b>, Items.<b>CellEditor</b>'); CellValue[OleVariant(h),OleVariant(1)] := 'Visible when clicking the cell'; with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.EditType; AddButton('B1',OleVariant(1),OleVariant(0),'This is a bit of text that''s shown when the cursor hovers the button B1',Null,Null); AddButton('B3',OleVariant(2),OleVariant(1),'This is a bit of text that''s shown when the cursor hovers the button B3',Null,Null); AddButton('B4',OleVariant(1),OleVariant(1),'This is a bit of text that''s shown when the cursor hovers the button B4',Null,Null); ButtonWidth := 24; end; h := AddItem('Column.<b>Editor</b>, Items.<b>CellEditor</b>'); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3); with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.CheckListType; AddItem(1,'Flag 1',Null); AddItem(2,'Flag 2',Null); AddItem(4,'Flag 4',Null); AddItem(8,'Flag 8',Null); AddButton('C1',OleVariant(1),OleVariant(0),'This is a bit of text that''s shown when the cursor hovers the button C1',Null,Null); AddButton('C3',OleVariant(2),OleVariant(0),'This is a bit of text that''s shown when the cursor hovers the button C2',Null,Null); AddButton('C4',OleVariant(1),OleVariant(0),'This is a bit of text that''s shown when the cursor hovers the button C3',Null,Null); ButtonWidth := 24; end; end; EndUpdate(); end |
698 |
The item is not getting selected when clicking the cell's checkbox. What should I do
// CellStateChanged event - Fired after cell's state has been changed. procedure TForm1.Grid1CellStateChanged(ASender: TObject; Item : HITEM;ColIndex : Integer); begin with Grid1 do begin Items.SelectItem[Item] := True; end end; with Grid1 do begin (IUnknown(Columns.Add('Check')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True); with Items do begin AddItem(OleVariant(0)); AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); end; end |
697 |
Is it possible to limit the height of the item while resizing
// AddItem event - Occurs after a new Item has been inserted to Items collection. procedure TForm1.Grid1AddItem(ASender: TObject; Item : HITEM); begin with Grid1 do begin Items.ItemMinHeight[Item] := 18; Items.ItemMaxHeight[Item] := 72; end end; with Grid1 do begin BeginUpdate(); ItemsAllowSizing := EXGRIDLib_TLB.exResizeItem; ScrollBySingleLine := False; BackColorAlternate := RGB(240,240,240); Columns.Add('Names'); with Items do begin AddItem('Mantel'); AddItem('Mechanik'); AddItem('Motor'); AddItem('Murks'); AddItem('Märchen'); AddItem('Möhren'); AddItem('Mühle'); end; Columns.Item[OleVariant(0)].SortOrder := EXGRIDLib_TLB.SortAscending; EndUpdate(); end |
696 |
Is it possible to copy the hierarchy of the control using the GetItems method
with Grid1 do begin LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Def'); with Items do begin h := AddItem('Root'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); end; PutItems(GetItems(OleVariant(-1)),Null); end |
695 |
Is it possible to auto-numbering the children items but still keeps the position after filtering
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; with (IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib_TLB.exFilter; Filter := 'Child 2'; end; with (IUnknown(Columns.Add('Pos.1')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 ropos '''''; Position := 0; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.2')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 ropos '':'''; Position := 1; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.3')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 ropos '':|A-Z'''; Position := 2; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.4')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 ropos ''|A-Z|'''; Position := 3; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.5')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '''<font Tahoma;7>'' + 1 ropos ''-<b>||A-Z'''; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Position := 4; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.6')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '''<b>''+ 1 ropos ''</b>:<fgcolor=FF0000>|A-Z|'''; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Position := 5; Width := 48; AllowSizing := False; end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); end; ApplyFilter(); EndUpdate(); end |
694 |
Is it possible to auto-numbering the children items too
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with (IUnknown(Columns.Add('Pos.1')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 rpos '''''; Position := 0; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.2')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 rpos '':'''; Position := 1; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.3')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 rpos '':|A-Z'''; Position := 2; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.4')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 rpos ''|A-Z|'''; Position := 3; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.5')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '''<font Tahoma;7>'' + 1 rpos ''-<b>||A-Z'''; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Position := 4; Width := 32; AllowSizing := False; end; with (IUnknown(Columns.Add('Pos.6')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '''<b>''+ 1 rpos ''</b>:<fgcolor=FF0000>|A-Z|'''; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Position := 5; Width := 48; AllowSizing := False; end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); end; EndUpdate(); end |
693 |
Is it possible to cancel or discard the values during validation
// ValidateValue event - Occurs before user changes the cell's value. procedure TForm1.Grid1ValidateValue(ASender: TObject; Item : HITEM;ColIndex : Integer;NewValue : OleVariant;var Cancel : WordBool); begin with Grid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( NewValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value. ' ); OutputDebugString( 'The DiscardValidateValue restores back the previously values.' ); DiscardValidateValue(); end end; with Grid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib_TLB.exValidateCell; (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DateType; (IUnknown(Columns.Add('Text')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; end; EndUpdate(); end |
692 |
Is it possible to validate the values of the cells only when user leaves the focused item
// ValidateValue event - Occurs before user changes the cell's value. procedure TForm1.Grid1ValidateValue(ASender: TObject; Item : HITEM;ColIndex : Integer;NewValue : OleVariant;var Cancel : WordBool); begin with Grid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( NewValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value. ' ); Cancel := True; OutputDebugString( 'You can not leave the item/record until the Cancel is False.' ); end end; with Grid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib_TLB.exValidateItem; (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DateType; (IUnknown(Columns.Add('Text')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; end; EndUpdate(); end |
691 |
We would like to validate the values of the cells. Is it possible
// ValidateValue event - Occurs before user changes the cell's value. procedure TForm1.Grid1ValidateValue(ASender: TObject; Item : HITEM;ColIndex : Integer;NewValue : OleVariant;var Cancel : WordBool); begin with Grid1 do begin OutputDebugString( 'ValidateValue' ); OutputDebugString( NewValue ); OutputDebugString( 'Change the Cancel parameter for ValidateValue event to accept/decline the newly value.' ); Cancel := True; OutputDebugString( 'You can not leave the cell until the Cancel is False.' ); end end; with Grid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib_TLB.exValidateCell; (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DateType; (IUnknown(Columns.Add('Text')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; CellValue[OleVariant(AddItem('1/1/2001')),OleVariant(1)] := 'text'; end; EndUpdate(); end |
690 |
Is there any way to add auto-numbering
with Grid1 do begin with Columns do begin Add('Items'); with (IUnknown(Add('Pos')) as EXGRIDLib_TLB.Column) do begin FormatColumn := '1 pos '''''; Position := 0; end; end; with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; end |
689 |
Does your control supports multiple lines tooltip
|
688 |
How can I prevent highlighting the column from the cursor - point
with Grid1 do begin VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAEGg4BI0IQAAYAQGKIYBkAKBQAGaAoDDUOQzQwAAxDKKUEwsACEIrjKCYVgOHYYRrIMYgBCMJhLEoaZLhEZRQiqDYtRDFQBSDDcPw/EaRZohGaYJg' + 'EgI='); Background[EXGRIDLib_TLB.exCursorHoverColumn] := $1000000; (IUnknown(Columns.Add('S')) as EXGRIDLib_TLB.Column).Width := 32; (IUnknown(Columns.Add('Level 1')) as EXGRIDLib_TLB.Column).LevelKey := OleVariant(1); (IUnknown(Columns.Add('Level 2')) as EXGRIDLib_TLB.Column).LevelKey := OleVariant(1); (IUnknown(Columns.Add('Level 3')) as EXGRIDLib_TLB.Column).LevelKey := OleVariant(1); (IUnknown(Columns.Add('E1')) as EXGRIDLib_TLB.Column).Width := 32; (IUnknown(Columns.Add('E2')) as EXGRIDLib_TLB.Column).Width := 32; (IUnknown(Columns.Add('E3')) as EXGRIDLib_TLB.Column).Width := 32; (IUnknown(Columns.Add('E4')) as EXGRIDLib_TLB.Column).Width := 32; end |
687 |
Is it possible display numbers in the same format no matter of regional settings in the control panel
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default positive)'''; h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''2|.|3|,|1|1'')'; h := AddItem(OleVariant(-100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default negative)'''; h := AddItem(OleVariant(-100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''2|.|3|,|1|1'')'; end; EndUpdate(); end |
686 |
Is it possible to add a 0 for numbers less than 1 instead .7 to show 0.8
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(0.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(0.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''|||||0'') + '' <fgcolor=808080>(Display no leading zeros)'''; end; EndUpdate(); end |
685 |
How can I specify the format for negative numbers
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(-100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(-100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''||||1'') + '' <fgcolor=808080>(Negative sign, number; for example, -1.1)'''; end; EndUpdate(); end |
684 |
Is it possible to change the grouping character when display numbers
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''|||-'') + '' <fgcolor=808080>(grouping character is -)'''; end; EndUpdate(); end |
683 |
How can I display numbers with 2 digits in each group
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(100000.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''||2'') + '' <fgcolor=808080>(grouping by 2 digits)'''; end; EndUpdate(); end |
682 |
How can I display my numbers using a different decimal separator
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''|;'') + '' <fgcolor=808080>(decimal separator is <b>;</b>)'''; end; EndUpdate(); end |
681 |
Is it possible to display the numbers using 3 (three) digits
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format '''') + '' <fgcolor=808080>(default)'''; h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format ''3'') + '' <fgcolor=808080>(3 digits)'''; h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format 2) + '' <fgcolor=808080>(2 digits)'''; h := AddItem(OleVariant(100.27)); FormatCell[OleVariant(h),OleVariant(0)] := '(value format 1) + '' <fgcolor=808080>(1 digit)'''; end; EndUpdate(); end |
680 |
Is there any option to show the tooltip programmatically
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin ShowToolTip(ItemFromPoint[-1,-1,c,hit],'','8','8',Null); end end; with Grid1 do begin BeginUpdate(); Columns.Add('Def'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; EndUpdate(); end |
679 |
How can I specify the column's width to be the same for all columns
with Grid1 do begin with Columns do begin Add('A'); Add('B'); Add('C'); end; DrawGridLines := EXGRIDLib_TLB.exAllLines; ColumnAutoResize := True; end |
678 |
How can I set the column's width to my desired width
with Grid1 do begin ColumnAutoResize := False; with Columns do begin (IUnknown(Add('A')) as EXGRIDLib_TLB.Column).Width := 128; (IUnknown(Add('B')) as EXGRIDLib_TLB.Column).Width := 128; end; DrawGridLines := EXGRIDLib_TLB.exAllLines; end |
677 |
Is it possible to format numbers
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (IUnknown(Add('A')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('B')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('A+B+C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; Width := 64; ComputedField := 'dbl(%1)+dbl(%2)+dbl(%3)'; FormatColumn := 'type(value) in (0,1) ? ''null'' : ( dbl(value)<0 ? ''<fgcolor=FF0000>''+ (value format ''2|.|3|,|1'' ) : (dbl(value)>0 ? ''<fgcolor=000' + '0FF>+''+(value format ''2|.|3|,'' ): ''0.00'') )'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[OleVariant(h),OleVariant(4)] := EXGRIDLib_TLB.exComputedField; h1 := InsertItem(h,Null,'Child 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(7); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(3); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(1); h1 := InsertItem(h,Null,'Child 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(-2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(-2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(-4); h1 := InsertItem(h,Null,'Child 3'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(-4); ExpandItem[h] := True; end; EndUpdate(); end |
676 |
How can I collapse all items
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[0] := False; end; EndUpdate(); end |
675 |
How can I expand all items
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[0] := True; end; EndUpdate(); end |
674 |
Can I display a total field without having to add a child item
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; with Editor do begin EditType := EXGRIDLib_TLB.SpinType; Numeric := EXGRIDLib_TLB.exFloat; end; end; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); LockedItemCount[EXGRIDLib_TLB.exBottom] := 1; h := LockedItem[EXGRIDLib_TLB.exBottom,0]; CellValue[OleVariant(h),OleVariant(0)] := 'sum(all,dir,dbl(%0))'; SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''SUM: ''+value'; end; EndUpdate(); end |
673 |
Can I display the number of child items
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exGroupLinesAtRoot; Columns.Add(''); with Items do begin h := AddItem('Root 1'); hx := SplitCell[OleVariant(h),OleVariant(0)]; CellValue[OleVariant(0),OleVariant(hx)] := 'count(current,dir,1)'; CellValueFormat[OleVariant(0),OleVariant(hx)] := EXGRIDLib_TLB.exTotalField; FormatCell[OleVariant(0),OleVariant(hx)] := '''Childs: '' + value'; InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); hx := SplitCell[OleVariant(h),OleVariant(0)]; CellValue[OleVariant(0),OleVariant(hx)] := 'count(current,dir,1)'; CellValueFormat[OleVariant(0),OleVariant(hx)] := EXGRIDLib_TLB.exTotalField; FormatCell[OleVariant(0),OleVariant(hx)] := '''Childs: '' + value'; InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); InsertItem(h,Null,'Child 3'); InsertItem(h,Null,'Child 4'); end; EndUpdate(); end |
672 |
My field does not display the correctly computed value if I enter data using the control's editors ( concatenation of strings ). What am I doing wrong
with Grid1 do begin BeginUpdate(); Columns.Add('T'); with (IUnknown(Columns.Add('A')) as EXGRIDLib_TLB.Column).Editor do begin Numeric := EXGRIDLib_TLB.exInteger; EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Columns.Add('B')) as EXGRIDLib_TLB.Column).Editor do begin Numeric := EXGRIDLib_TLB.exInteger; EditType := EXGRIDLib_TLB.SpinType; end; Columns.Add('A+B'); with Items do begin h := AddItem('Incorrect'); CellToolTip[OleVariant(h),OleVariant(0)] := 'Just type a number in the column A or B. The result will be concaternated'; CellValue[OleVariant(h),OleVariant(1)] := '10'; CellValue[OleVariant(h),OleVariant(2)] := '20'; CellValue[OleVariant(h),OleVariant(3)] := 'currency(%1+%2)'; CellValueFormat[OleVariant(h),OleVariant(3)] := EXGRIDLib_TLB.exComputedField; h := AddItem('Correct'); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(h),OleVariant(2)] := OleVariant(20); CellValue[OleVariant(h),OleVariant(3)] := 'currency(dbl(%1)+dbl(%2))'; CellValueFormat[OleVariant(h),OleVariant(3)] := EXGRIDLib_TLB.exComputedField; end; EndUpdate(); end |
671 |
The CellValue/CellCaption property gets the result of a computed/total field with text formatting. Is it possible to get that value without text formatting
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('A')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.SpinType; (IUnknown(Columns.Add('B')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.SpinType; Columns.Add('A+B'); with Items do begin h := AddItem(OleVariant(10)); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(20); CellValueFormat[OleVariant(h),OleVariant(2)] := EXGRIDLib_TLB.exComputedField; CellValue[OleVariant(h),OleVariant(2)] := 'currency(dbl(%0)+dbl(%1))'; OutputDebugString( 'CellCaption returns ' ); OutputDebugString( CellCaption[OleVariant(h),OleVariant(2)] ); OutputDebugString( 'CellValue returns ' ); OutputDebugString( CellValue[OleVariant(h),OleVariant(2)] ); OutputDebugString( 'ComputeValue returns ' ); OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',OleVariant(h),OleVariant(0),OleVariant(CellValueFormat[OleVariant(h),OleVariant(2)])] ); end; EndUpdate(); end |
670 |
Can I get the result of a specified formula as your control does using the ComputedField property
with Grid1 do begin BeginUpdate(); Columns.Add('A'); Columns.Add('B'); with Items do begin h := AddItem(OleVariant(10)); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(20); OutputDebugString( 'A+B is ' ); OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',OleVariant(h),OleVariant(0),OleVariant(2)] ); end; EndUpdate(); end |
669 |
Is it possible to get the text without HTML formatting
with Grid1 do begin BeginUpdate(); Columns.Add(''); with Items do begin h := AddItem('<b>bold</b>'); OutputDebugString( ComputeValue[CellValue[OleVariant(h),OleVariant(0)],OleVariant(h),OleVariant(0),OleVariant(1)] ); end; EndUpdate(); end |
668 |
Can I specify an item to be a separator
with Grid1 do begin BeginUpdate(); TreeColumnIndex := -1; SortOnClick := EXGRIDLib_TLB.exNoSort; Columns.Add('Numbers'); with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); h := AddItem('separator'); SelectableItem[h] := False; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerCenter; ItemDividerLine[h] := EXGRIDLib_TLB.ThinLine; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.CenterAlignment; AddItem(OleVariant(3)); AddItem(OleVariant(4)); end; EndUpdate(); end |
667 |
How can I count only non-zero values
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(0)); AddItem(OleVariant(0)); AddItem(OleVariant(0)); AddItem(OleVariant(0)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('sum(all,dir,dbl(%0)?1:0)'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''COUNT non-zero: ''+value'; end; EndUpdate(); end |
666 |
How can I add a AVG ( average ) field
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('avg(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''AVG: ''+value'; end; EndUpdate(); end |
665 |
How can I add a COUNT field
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('count(all,dir,0)'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''COUNT: ''+value'; end; EndUpdate(); end |
664 |
How can I add a MAX field
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('max(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
663 |
How can I add a MIN or MAX field (for numbers)
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(11)); AddItem(OleVariant(21)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('min(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
662 |
How can I add a SUM field
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('sum(all,dir,dbl(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''SUM: ''+value'; end; EndUpdate(); end |
661 |
How can I add total and subtotals fields
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exGroupLinesAtRoot; Columns.Add('Members'); with (IUnknown(Columns.Add('Values')) as EXGRIDLib_TLB.Column) do begin FormatColumn := 'currency(value)'; with Editor do begin EditType := EXGRIDLib_TLB.SpinType; Numeric := EXGRIDLib_TLB.exInteger; end; end; with Items do begin h := AddItem('Group 1'); ItemBold[h] := True; CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; CellValue[OleVariant(h),OleVariant(1)] := 'sum(current,dir,dbl(%1))'; CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); CellHAlignment[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.RightAlignment; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(20); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(30); ExpandItem[h] := True; h := AddItem('Group 2'); ItemBold[h] := True; CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; CellValue[OleVariant(h),OleVariant(1)] := 'sum(current,dir,dbl(%1))'; CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); CellHAlignment[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.RightAlignment; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(5); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(15); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(35); h := AddItem('total'); CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,dbl(%1))'; CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; FormatCell[OleVariant(h),OleVariant(1)] := '''Total: <b>'' + currency(value)'; CellHAlignment[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.RightAlignment; ItemDivider[h] := 1; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerCenter; ItemDividerLine[h] := EXGRIDLib_TLB.DoubleLine; SortableItem[h] := False; end; EndUpdate(); end |
660 |
Is is possible to have subtotal items, and a grand total item
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); BackColor := RGB(255,255,255); LinesAtRoot := EXGRIDLib_TLB.exGroupLinesAtRoot; ShowFocusRect := False; Columns.Add('Members'); with (IUnknown(Columns.Add('Values')) as EXGRIDLib_TLB.Column) do begin FormatColumn := 'currency(value)'; with Editor do begin EditType := EXGRIDLib_TLB.SpinType; Numeric := EXGRIDLib_TLB.exInteger; end; end; with Items do begin h := AddItem('Group 1'); ItemBold[h] := True; SortableItem[h] := False; CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; FormatCell[OleVariant(h),OleVariant(1)] := ' '; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(20); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(30); hT := InsertItem(h,Null,'subtotal'); CellHAlignment[OleVariant(hT),OleVariant(1)] := EXGRIDLib_TLB.RightAlignment; CellEditorVisible[OleVariant(hT),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; CellValue[OleVariant(hT),OleVariant(1)] := 'sum(parent,dir,dbl(%1))'; CellValueFormat[OleVariant(hT),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); FormatCell[OleVariant(hT),OleVariant(1)] := '''subtotal: <b>'' + currency(value)'; ItemDivider[hT] := 1; ItemDividerLineAlignment[hT] := EXGRIDLib_TLB.DividerCenter; SortableItem[hT] := False; SelectableItem[hT] := False; ItemDividerLine[hT] := EXGRIDLib_TLB.DotLine; ExpandItem[h] := True; h := AddItem('Group 2'); ItemBold[h] := True; SortableItem[h] := False; FormatCell[OleVariant(h),OleVariant(1)] := ' '; CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(15); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(25); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(18); hT := InsertItem(h,Null,'subtotal'); CellHAlignment[OleVariant(hT),OleVariant(1)] := EXGRIDLib_TLB.RightAlignment; CellEditorVisible[OleVariant(hT),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; CellValue[OleVariant(hT),OleVariant(1)] := 'sum(parent,dir,dbl(%1))'; CellValueFormat[OleVariant(hT),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); FormatCell[OleVariant(hT),OleVariant(1)] := '''subtotal: <b>'' + currency(value)'; ItemDivider[hT] := 1; ItemDividerLineAlignment[hT] := EXGRIDLib_TLB.DividerCenter; ItemDividerLine[hT] := EXGRIDLib_TLB.DotLine; SortableItem[hT] := False; SelectableItem[hT] := False; ExpandItem[h] := True; h := AddItem('total'); CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,dbl(%1))'; CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; FormatCell[OleVariant(h),OleVariant(1)] := '''Total: <b><font ;11>'' + currency(value)'; CellHAlignment[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.CenterAlignment; ItemDivider[h] := 1; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerCenter; ItemDividerLine[h] := EXGRIDLib_TLB.DoubleLine; SortableItem[h] := False; SelectableItem[h] := False; end; EndUpdate(); end |
659 |
Is it possible to have a total field for each column
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('C1')) as EXGRIDLib_TLB.Column) do begin with Editor do begin Numeric := EXGRIDLib_TLB.exInteger; EditType := EXGRIDLib_TLB.SpinType; end; SortType := EXGRIDLib_TLB.SortNumeric; end; with (IUnknown(Columns.Add('C2')) as EXGRIDLib_TLB.Column) do begin with Editor do begin Numeric := EXGRIDLib_TLB.exInteger; EditType := EXGRIDLib_TLB.SpinType; end; SortType := EXGRIDLib_TLB.SortNumeric; end; with Items do begin LockedItemCount[EXGRIDLib_TLB.exBottom] := 1; h := LockedItem[EXGRIDLib_TLB.exBottom,0]; ItemBackColor[h] := $f0f0f0; ItemBold[h] := True; CellValue[OleVariant(h),OleVariant(0)] := 'sum(all,dir,dbl(%0))'; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,dir,dbl(%1))'; CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField; end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(10))),OleVariant(1)] := OleVariant(12); CellValue[OleVariant(AddItem(OleVariant(25))),OleVariant(1)] := OleVariant(5); CellValue[OleVariant(AddItem(OleVariant(31))),OleVariant(1)] := OleVariant(17); CellValue[OleVariant(AddItem(OleVariant(48))),OleVariant(1)] := OleVariant(22); end; EndUpdate(); end |
658 |
How can I add a total field for a DataSource being used
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin ColumnAutoResize := False; ContinueColumnScroll := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); with Items do begin LockedItemCount[EXGRIDLib_TLB.exTop] := 1; h := LockedItem[EXGRIDLib_TLB.exTop,0]; ItemDivider[h] := 0; CellValueFormat[OleVariant(h),OleVariant(0)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); CellValue[OleVariant(h),OleVariant(0)] := 'sum(all,dir,%1)'; end; end |
657 |
How can I add a total field
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column) do begin with Editor do begin Numeric := EXGRIDLib_TLB.exInteger; EditType := EXGRIDLib_TLB.SpinType; end; SortType := EXGRIDLib_TLB.SortNumeric; end; with Items do begin LockedItemCount[EXGRIDLib_TLB.exTop] := 1; h := LockedItem[EXGRIDLib_TLB.exTop,0]; ItemBackColor[h] := $f0f0f0; CellValue[OleVariant(h),OleVariant(0)] := 'sum(all,dir,dbl(%0))'; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''Total: ''+value'; end; with Items do begin AddItem(OleVariant(10)); AddItem(OleVariant(25)); AddItem(OleVariant(31)); AddItem(OleVariant(48)); end; EndUpdate(); end |
656 |
How can I add a total field
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.SpinType; Numeric := EXGRIDLib_TLB.exInteger; end; with Items do begin h := AddItem('Group 1'); CellEditorVisible[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exEditorHidden; InsertItem(h,Null,OleVariant(10)); InsertItem(h,Null,OleVariant(20)); InsertItem(h,Null,OleVariant(30)); hT := InsertItem(h,Null,'sum(parent,dir,dbl(%0))'); CellEditorVisible[OleVariant(hT),OleVariant(0)] := EXGRIDLib_TLB.exEditorHidden; CellValueFormat[OleVariant(hT),OleVariant(0)] := Integer(EXGRIDLib_TLB.exTotalField) Or Integer(EXGRIDLib_TLB.exHTML); ItemDivider[hT] := 0; ItemDividerLineAlignment[hT] := EXGRIDLib_TLB.DividerTop; SelectableItem[hT] := False; SortableItem[hT] := False; ExpandItem[h] := True; end; EndUpdate(); end |
655 |
Is it possible to specify the cell's value but still want to display some formatted text instead the value
with Grid1 do begin BeginUpdate(); Columns.Add('Value'); Columns.Add('FormatCell'); with Items do begin h := AddItem(OleVariant(1)); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(12); FormatCell[OleVariant(h),OleVariant(1)] := 'currency(value)'; h := AddItem('1/1/2001'); CellValue[OleVariant(h),OleVariant(1)] := '1/1/2001'; CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exHTML; FormatCell[OleVariant(h),OleVariant(1)] := 'longdate(value) replace ''2001'' with ''<b>2001</b>'''; end; EndUpdate(); end |
654 |
How can I simulate displaying groups
with Grid1 do begin HasLines := EXGRIDLib_TLB.exNoLine; ScrollBySingleLine := True; with Columns do begin Add('Name'); Add('A'); Add('B'); Add('C'); end; with Items do begin h := AddItem('Group 1'); CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.CenterAlignment; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerBoth; ItemHeight[h] := 24; SortableItem[h] := False; h1 := InsertItem(h,Null,'Child 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(3); h1 := InsertItem(h,Null,'Child 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(4); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(5); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(6); ExpandItem[h] := True; h := AddItem('Group 2'); CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.CenterAlignment; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerBoth; ItemHeight[h] := 24; SortableItem[h] := False; h1 := InsertItem(h,Null,'Child 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(3); h1 := InsertItem(h,Null,'Child 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(4); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(5); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(6); ExpandItem[h] := True; end; end |
653 |
Is it possible to specify the cell's value but still want to display some formatted text instead the value
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (IUnknown(Add('Values')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 64; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Root'); FormatCell[OleVariant(h),OleVariant(1)] := '''<none>'''; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(15); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(25); ExpandItem[h] := True; end; EndUpdate(); end |
652 |
I am using the FormatColumn to display the current currency, but would like hide some values. Is it possible
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (IUnknown(Add('Values')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 64; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Root'); FormatCell[OleVariant(h),OleVariant(1)] := ' '; CellValue[OleVariant(InsertItem(h,Null,'Child 1')),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(InsertItem(h,Null,'Child 2')),OleVariant(1)] := OleVariant(15); CellValue[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(1)] := OleVariant(25); ExpandItem[h] := True; end; EndUpdate(); end |
651 |
How can I specify an item to be always the first item
with Grid1 do begin BeginUpdate(); TreeColumnIndex := -1; (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('first'); ItemPosition[h] := 0; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; SortableItem[h] := False; SortChildren(0,OleVariant(0),False); end; EndUpdate(); end |
650 |
How can I specify an item to be always the last item
with Grid1 do begin BeginUpdate(); TreeColumnIndex := -1; (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('last'); CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; SortableItem[h] := False; SortChildren(0,OleVariant(0),True); end; EndUpdate(); end |
649 |
Can I allow sorting only the child items
with Grid1 do begin BeginUpdate(); Columns.Add('Childs'); with Items do begin h := AddItem('Root 1'); SortableItem[h] := False; InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); SortableItem[h] := False; InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; end; EndUpdate(); end |
648 |
Can I specify a terminal item so it will mark the end of childs
with Grid1 do begin BeginUpdate(); ScrollBySingleLine := True; Columns.Add('P1'); with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := InsertItem(h,'',''); ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerCenter; ItemHeight[h] := 2; SelectableItem[h] := False; SortableItem[h] := False; h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := InsertItem(h,'',''); ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerCenter; ItemHeight[h] := 2; SelectableItem[h] := False; SortableItem[h] := False; end; EndUpdate(); end |
647 |
Is it possible to specify an item being unsortable so its position won't be changed after sorting
with Grid1 do begin BeginUpdate(); TreeColumnIndex := -1; (IUnknown(Columns.Add('Numbers')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortNumeric; with Items do begin AddItem(OleVariant(1)); AddItem(OleVariant(2)); AddItem(OleVariant(3)); AddItem(OleVariant(4)); h := AddItem('top 3'); ItemPosition[h] := 3; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; SortableItem[h] := False; SortChildren(0,OleVariant(0),False); end; EndUpdate(); end |
646 |
Is it possible to move an item from a parent to another
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin AddItem('A'); AddItem('B'); InsertItem(AddItem('C'),'','D'); SetParent(FindItem['D',OleVariant(0),Null],FindItem['A',OleVariant(0),Null]); end; EndUpdate(); end |
645 |
How can I change the identation for an item
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin AddItem('A'); AddItem('B'); InsertItem(AddItem('C'),'','D'); SetParent(FindItem['D',OleVariant(0),Null],0); end; EndUpdate(); end |
644 |
How can I arrange the control's header on multiple levels
with Grid1 do begin BeginUpdate(); DefaultItemHeight := 48; with Columns do begin (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('FirstName')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('LastName')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('Photo')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Add('Address')) as EXGRIDLib_TLB.Column) do begin Visible := False; Def[EXGRIDLib_TLB.exCellSingleLine] := OleVariant(False); end; with (IUnknown(Add('Personal Info')) as EXGRIDLib_TLB.Column) do begin FormatLevel := '3:48,(0/1/2),4:96'; Def[EXGRIDLib_TLB.exCellFormatLevel] := '3:48,(0/1/2),4:96'; end; end; with Items do begin h := AddItem('Sales Representative'); CellValue[OleVariant(h),OleVariant(1)] := 'Nancy'; CellValue[OleVariant(h),OleVariant(2)] := 'Davolio'; CellPicture[OleVariant(h),OleVariant(3)] := Grid1.ExecuteTemplate('loadpicture(`c:\exontrol\images\zipdisk.gif`)'); CellValue[OleVariant(h),OleVariant(4)] := '507-20th Ave. E.Apt. 2A'; end; EndUpdate(); end |
643 |
How can I filter programatically using more columns
with Grid1 do begin BeginUpdate(); with Columns do begin Add('Car'); Add('Equipment'); end; with Items do begin CellValue[OleVariant(AddItem('Mazda')),OleVariant(1)] := 'Air Bag'; CellValue[OleVariant(AddItem('Toyota')),OleVariant(1)] := 'Air Bag,Air condition'; CellValue[OleVariant(AddItem('Ford')),OleVariant(1)] := 'Air condition'; CellValue[OleVariant(AddItem('Nissan')),OleVariant(1)] := 'Air Bag,ABS,ESP'; CellValue[OleVariant(AddItem('Mazda')),OleVariant(1)] := 'Air Bag, ABS,ESP'; CellValue[OleVariant(AddItem('Mazda')),OleVariant(1)] := 'ABS,ESP'; end; with Columns.Item['Car'] do begin FilterType := EXGRIDLib_TLB.exFilter; Filter := 'Mazda'; end; with Columns.Item['Equipment'] do begin FilterType := EXGRIDLib_TLB.exPattern; Filter := '*ABS*|*ESP*'; end; ApplyFilter(); EndUpdate(); end |
642 |
How can I show the ticks for a single slider field
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Slider')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.SliderType; with Items do begin AddItem(OleVariant(10)); with CellEditor[OleVariant(AddItem(OleVariant(20))),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.SliderType; Option[EXGRIDLib_TLB.exSliderTickFrequency] := OleVariant(10); end; AddItem(OleVariant(30)); end; EndUpdate(); end |
641 |
Is it possible to show ticks for slider fields
with Grid1 do begin with (IUnknown(Columns.Add('Slider')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.SliderType; Option[EXGRIDLib_TLB.exSliderTickFrequency] := OleVariant(10); end; Items.AddItem(OleVariant(10)); end |
640 |
Is it possible to colour a particular column, I mean the cell's foreground color
with Grid1 do begin BeginUpdate(); with ConditionalFormats.Add('1',Null) do begin ForeColor := $ff; ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($1); end; MarkSearchColumn := False; with Columns do begin Add('Column 1'); Add('Column 2'); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(0))),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(AddItem(OleVariant(2))),OleVariant(1)] := OleVariant(3); CellValue[OleVariant(AddItem(OleVariant(4))),OleVariant(1)] := OleVariant(5); end; EndUpdate(); end |
639 |
Is it possible to colour a particular column for specified values
with Grid1 do begin BeginUpdate(); with ConditionalFormats.Add('int(%1) in (3,4,5)',Null) do begin BackColor := $ff; ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($1); end; MarkSearchColumn := False; with Columns do begin Add('Column 1'); Add('Column 2'); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(0))),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(AddItem(OleVariant(2))),OleVariant(1)] := OleVariant(3); CellValue[OleVariant(AddItem(OleVariant(4))),OleVariant(1)] := OleVariant(5); end; EndUpdate(); end |
638 |
Is it possible to colour a particular column
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(255); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(0))),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(AddItem(OleVariant(2))),OleVariant(1)] := OleVariant(3); CellValue[OleVariant(AddItem(OleVariant(4))),OleVariant(1)] := OleVariant(5); end; EndUpdate(); end |
637 |
How do i get all the children items that are under a certain parent Item handle
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('P'); with Items do begin h := AddItem('Root'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; end; with Items do begin hChild := ItemChild[FirstVisibleItem]; OutputDebugString( CellValue[OleVariant(hChild),OleVariant(0)] ); OutputDebugString( CellValue[OleVariant(NextSiblingItem[hChild]),OleVariant(0)] ); end; EndUpdate(); end |
636 |
Is is possible to use HTML tags to display in the filter caption
with Grid1 do begin BeginUpdate(); FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarCaption := 'This is a bit of text being displayed in the filter bar.'; Columns.Add(''); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; EndUpdate(); end |
635 |
How can I find the number of items after filtering
with Grid1 do begin BeginUpdate(); Columns.Add(''); with Items do begin h := AddItem(''); CellValue[OleVariant(h),OleVariant(0)] := OleVariant(VisibleItemCount); end; EndUpdate(); end |
634 |
How can I change the filter caption
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib_TLB.exFilterPromptWords) Or Integer(EXGRIDLib_TLB.exFilterPromptContainsAll); FilterBarPromptPattern := 'london robert'; FilterBarCaption := '<r>Found: ... '; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
633 |
While using the filter prompt is it is possible to use wild characters
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptPattern; FilterBarPromptPattern := 'lon* seat*'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
632 |
How can I list all items that contains any of specified words, not necessary at the beggining
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib_TLB.exFilterPromptStartWords) Or Integer(EXGRIDLib_TLB.exFilterPromptContainsAny); FilterBarPromptPattern := 'london davolio'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
631 |
How can I list all items that contains any of specified words, not strings
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib_TLB.exFilterPromptWords) Or Integer(EXGRIDLib_TLB.exFilterPromptContainsAny); FilterBarPromptPattern := 'london nancy'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
630 |
How can I list all items that contains all specified words, not strings
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib_TLB.exFilterPromptWords) Or Integer(EXGRIDLib_TLB.exFilterPromptContainsAll); FilterBarPromptPattern := 'london robert'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
629 |
I've noticed that the filtering by prompt is not case sensitive, is is possible to make it case sensitive
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := Integer(EXGRIDLib_TLB.exFilterPromptCaseSensitive) Or Integer(EXGRIDLib_TLB.exFilterPromptContainsAny); FilterBarPromptPattern := 'Anne'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
628 |
Is it possible to list only items that ends with any of specified strings
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptEndWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'Fuller'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
627 |
Is it possible to list only items that ends with any of specified strings
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptEndWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'Fuller'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
626 |
Is it possible to list only items that starts with any of specified strings
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptStartWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'An M'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
625 |
Is it possible to list only items that starts with specified string
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptStartWith; FilterBarPromptColumns := '0'; FilterBarPromptPattern := 'A'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
624 |
How can I specify that the list should include any of the seqeunces in the pattern
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptContainsAny; FilterBarPromptPattern := 'london seattle'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
623 |
How can I specify that all sequences in the filter pattern must be included in the list
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptContainsAll; FilterBarPromptPattern := 'london manager'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
622 |
How do I change at runtime the filter prompt
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptPattern := 'london manager'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
621 |
How do I specify to filter only a single column when using the filter prompt
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPromptColumns := '2,3'; FilterBarPromptPattern := 'london'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
620 |
How do I change the prompt or the caption being displayed in the filter bar
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; FilterBarPrompt := 'changed'; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; EndUpdate(); end |
619 |
How do I enable the filter prompt feature
with Grid1 do begin BeginUpdate(); ColumnAutoResize := True; ContinueColumnScroll := False; FocusColumnIndex := 1; MarkSearchColumn := False; SearchColumnIndex := 1; FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible; with Columns do begin (IUnknown(Add('Name')) as EXGRIDLib_TLB.Column).Width := 96; (IUnknown(Add('Title')) as EXGRIDLib_TLB.Column).Width := 96; Add('City'); end; with Items do begin h0 := AddItem('Nancy Davolio'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Andrew Fuller'); CellValue[OleVariant(h0),OleVariant(1)] := 'Vice President, Sales'; CellValue[OleVariant(h0),OleVariant(2)] := 'Tacoma'; SelectItem[h0] := True; h0 := AddItem('Janet Leverling'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Kirkland'; h0 := AddItem('Margaret Peacock'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'Redmond'; h0 := AddItem('Steven Buchanan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Manager'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Michael Suyama'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Robert King'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; h0 := AddItem('Laura Callahan'); CellValue[OleVariant(h0),OleVariant(1)] := 'Inside Sales Coordinator'; CellValue[OleVariant(h0),OleVariant(2)] := 'Seattle'; h0 := AddItem('Anne Dodsworth'); CellValue[OleVariant(h0),OleVariant(1)] := 'Sales Representative'; CellValue[OleVariant(h0),OleVariant(2)] := 'London'; end; EndUpdate(); end |
618 |
How can I control the colors that can be applied to an EBN part
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin with Items do begin ItemBackColor[FirstVisibleItem] := NewValue; end; end end; with Grid1 do begin BeginUpdate(); with VisualAppearance do begin Add(2,'c:\exontrol\images\normal.ebn'); Add(1,'CP:2 10 3 -10 -5'); end; SelBackColor := BackColor; SelForeColor := ForeColor; ScrollBySingleLine := True; TreeColumnIndex := -1; with Columns do begin with (IUnknown(Add('Test')) as EXGRIDLib_TLB.Column) do begin Width := 32; end; with (IUnknown(Add('RGB')) as EXGRIDLib_TLB.Column) do begin with Editor do begin EditType := EXGRIDLib_TLB.SliderType; Option[EXGRIDLib_TLB.exSliderMax] := OleVariant(255); Option[EXGRIDLib_TLB.exSliderWidth] := OleVariant(-60); end; end; end; with Items do begin h := AddItem(''); CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.CenterAlignment; ItemDivider[h] := 0; ItemBackColor[h] := $1000000; ItemHeight[h] := 36; SelectableItem[h] := False; h := InsertItem(0,OleVariant(1),'Red'); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(255); h := InsertItem(0,OleVariant(255),'Green'); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(255); h := InsertItem(0,OleVariant(65536),'Blue'); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(255); end; EndUpdate(); end |
617 |
I know this is fairly basic, but could you send me a sample that places a tree in the first column
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('heading'); with Items do begin h := AddItem('Parent 1'); InsertItem(h,Null,'Child A'); InsertItem(InsertItem(h,Null,'Child B'),Null,'GrandChild C'); ExpandItem[h] := True; h := AddItem('Parent 2'); InsertItem(h,Null,'Child D'); InsertItem(h,Null,'Child E'); ExpandItem[h] := True; end; EndUpdate(); end |
616 |
How can I get the caption of focused item
// SelectionChanged event - Fired after a new item has been selected. procedure TForm1.Grid1SelectionChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin OutputDebugString( 'Handle' ); OutputDebugString( FocusItem ); OutputDebugString( 'Caption' ); OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(0)] ); end; end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Null,'Cell 1.1'); InsertItem(h,Null,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'Cell 2.1'); InsertItem(h,Null,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
615 |
How can I get the caption of selected item
// SelectionChanged event - Fired after a new item has been selected. procedure TForm1.Grid1SelectionChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin OutputDebugString( 'Handle' ); OutputDebugString( SelectedItem[0] ); OutputDebugString( 'Caption' ); OutputDebugString( CellCaption[OleVariant(SelectedItem[0]),OleVariant(0)] ); end; end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Null,'Cell 1.1'); InsertItem(h,Null,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'Cell 2.1'); InsertItem(h,Null,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
614 |
Is it possible to let users selects cells as in Excel
with Grid1 do begin BeginUpdate(); FullRowSelect := EXGRIDLib_TLB.exRectSel; SingleSel := False; ReadOnly := EXGRIDLib_TLB.exReadOnly; MarkSearchColumn := False; ShowFocusRect := False; LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; SelForeColor := RGB(0,0,0); SelBackColor := RGB(200,225,242); with Columns do begin Add('A'); with (IUnknown(Add('B')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 24; end; with (IUnknown(Add('C')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 24; Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(1); PartialCheck := True; end; with (IUnknown(Add('D')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 24; Def[EXGRIDLib_TLB.exCellHasRadioButton] := OleVariant(1); end; end; with Items do begin h := InsertItem(Null,Null,'Group 1'); h1 := InsertItem(h,Null,OleVariant(16)); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(17); h1 := InsertItem(h,Null,OleVariant(2)); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(11); h1 := InsertItem(h,Null,OleVariant(2)); ItemBackColor[h1] := $f0f0f0; CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(9); ExpandItem[h] := True; h := InsertItem(Null,Null,'Group 2'); CellValueFormat[OleVariant(h),OleVariant(2)] := EXGRIDLib_TLB.exHTML; h1 := InsertItem(h,Null,OleVariant(16)); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(9); h1 := InsertItem(h,Null,OleVariant(12)); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(11); h1 := InsertItem(h,Null,OleVariant(2)); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); ExpandItem[h] := True; SelectItem[h] := True; end; EndUpdate(); end |
613 |
Is it possible to change the style for the vertical or horizontal grid lines, in the list area
with Grid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib_TLB.exAllLines; GridLineStyle := Integer(EXGRIDLib_TLB.exGridLinesVSolid) Or Integer(EXGRIDLib_TLB.exGridLinesHDot4); Columns.Add('C1'); Columns.Add('C2'); Columns.Add('C3'); with Items do begin h := AddItem('Item 1'); CellValue[OleVariant(h),OleVariant(1)] := 'SubItem 1.2'; CellValue[OleVariant(h),OleVariant(2)] := 'SubItem 1.3'; h := AddItem('Item 2'); CellValue[OleVariant(h),OleVariant(1)] := 'SubItem 2.2'; CellValue[OleVariant(h),OleVariant(2)] := 'SubItem 2.3'; end; EndUpdate(); end |
612 |
Is it possible to change the style for the grid lines, for instance to be solid not dotted
|
611 |
I have some buttons added on the control's scroll bar, how can I can know when the button is being clicked
// ScrollButtonClick event - Occurs when the user clicks a button in the scrollbar. procedure TForm1.Grid1ScrollButtonClick(ASender: TObject; ScrollBar : ScrollBarEnum;ScrollPart : ScrollPartEnum); begin with Grid1 do begin OutputDebugString( ScrollBar ); OutputDebugString( ScrollPart ); end end; with Grid1 do begin ScrollPartVisible[EXGRIDLib_TLB.exHScroll,EXGRIDLib_TLB.exLeftB1Part] := True; ScrollPartVisible[EXGRIDLib_TLB.exHScroll,EXGRIDLib_TLB.exLeftB2Part] := True; ScrollPartVisible[EXGRIDLib_TLB.exHScroll,EXGRIDLib_TLB.exRightB6Part] := True; ScrollPartVisible[EXGRIDLib_TLB.exHScroll,EXGRIDLib_TLB.exRightB5Part] := True; ScrollBars := EXGRIDLib_TLB.exDisableNoHorizontal; end |
610 |
How do I get notified once the user clicks a hyperlink created using the anchor HTML tag
// AnchorClick event - Occurs when an anchor element is clicked. procedure TForm1.Grid1AnchorClick(ASender: TObject; AnchorID : WideString;Options : WideString); begin with Grid1 do begin OutputDebugString( AnchorID ); OutputDebugString( Options ); end end; with Grid1 do begin (IUnknown(Columns.Add('Default')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin AddItem('This is a link: <aex.com;1>www.exontrol.com</a>'); AddItem('This is a link: <aex.net;2>www.exontrol.net</a>'); end; end |
609 |
Is it possible to start editing a cell when double click it
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TForm1.Grid1DblClick(ASender: TObject; Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin Edit(Null); end end; with Grid1 do begin BeginUpdate(); AutoEdit := False; MarkSearchColumn := False; (IUnknown(Columns.Add('Edit1')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Columns.Add('Edit2')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem(OleVariant(1))),OleVariant(1)] := OleVariant(2); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(3))),OleVariant(1)] := OleVariant(4); end; EndUpdate(); end |
608 |
Is it possible to disable standard single-click behavior for this column, so I manually could call Edit() when needed
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TForm1.Grid1DblClick(ASender: TObject; Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin Edit(Null); end end; with Grid1 do begin BeginUpdate(); AutoEdit := False; MarkSearchColumn := False; (IUnknown(Columns.Add('Edit1')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Columns.Add('Edit2')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem(OleVariant(1))),OleVariant(1)] := OleVariant(2); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(3))),OleVariant(1)] := OleVariant(4); end; EndUpdate(); end |
607 |
How can I get or restore the old or previously value for the cell being changed
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin OutputDebugString( 'Old-Value:' ); OutputDebugString( Items.CellValue[OleVariant(Item),OleVariant(ColIndex)] ); OutputDebugString( 'New-Value:' ); OutputDebugString( NewValue ); end end; with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; (IUnknown(Columns.Add('Edit1')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Columns.Add('Edit2')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem(OleVariant(1))),OleVariant(1)] := OleVariant(2); end; with Items do begin CellValue[OleVariant(AddItem(OleVariant(3))),OleVariant(1)] := OleVariant(4); end; EndUpdate(); end |
606 |
How can I get the item from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin h := ItemFromPoint[-1,-1,c,hit]; OutputDebugString( 'Handle' ); OutputDebugString( h ); OutputDebugString( 'Index' ); OutputDebugString( Items.ItemToIndex[h] ); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; DrawGridLines := EXGRIDLib_TLB.exHLines; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Null,'Cell 1.1'); InsertItem(h,Null,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'Cell 2.1'); InsertItem(h,Null,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
605 |
How can I get the column from the cursor, not only in the header
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin OutputDebugString( ColumnFromPoint[-1,0] ); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('P1'); Columns.Add('P2'); DrawGridLines := EXGRIDLib_TLB.exAllLines; with Items do begin h := AddItem('R1'); CellValue[OleVariant(h),OleVariant(1)] := 'R2'; CellValue[OleVariant(InsertItem(h,Null,'Cell 1.1')),OleVariant(1)] := 'Cell 1.2'; CellValue[OleVariant(InsertItem(h,Null,'Cell 2.1')),OleVariant(1)] := 'Cell 2.2'; ExpandItem[h] := True; end; EndUpdate(); end |
604 |
How can I get the column from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin OutputDebugString( ColumnFromPoint[-1,-1] ); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; DrawGridLines := EXGRIDLib_TLB.exAllLines; Columns.Add('P1'); Columns.Add('P2'); with Items do begin h := AddItem('R1'); CellValue[OleVariant(h),OleVariant(1)] := 'R2'; CellValue[OleVariant(InsertItem(h,Null,'Cell 1.1')),OleVariant(1)] := 'Cell 1.2'; CellValue[OleVariant(InsertItem(h,Null,'Cell 2.1')),OleVariant(1)] := 'Cell 2.2'; ExpandItem[h] := True; end; EndUpdate(); end |
603 |
How can I get the cell's caption from the cursor
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin h := ItemFromPoint[-1,-1,c,hit]; OutputDebugString( Items.CellCaption[OleVariant(h),OleVariant(c)] ); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Columns.Add('Items'); with Items do begin h := AddItem('R1'); InsertItem(h,Null,'Cell 1.1'); InsertItem(h,Null,'Cell 1.2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'Cell 2.1'); InsertItem(h,Null,'Cell 2.2'); ExpandItem[h] := True; end; EndUpdate(); end |
602 |
How can I customize the items based on the values in the cells
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with ConditionalFormats do begin with Add('%1 >4',Null) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib_TLB.exFormatToItems; end; with Add('%2 > 4',Null) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2); end; with Add('%3 > 4',Null) do begin Bold := True; StrikeOut := True; ForeColor := $ff; ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($3); end; end; with Columns do begin Add('Name'); with (IUnknown(Add('A')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('B')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('A+B+C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 64; ComputedField := '%1+%2+%3'; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[OleVariant(h),OleVariant(4)] := EXGRIDLib_TLB.exComputedField; h1 := InsertItem(h,Null,'Child 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(7); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(3); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(1); h1 := InsertItem(h,Null,'Child 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(5); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(12); h1 := InsertItem(h,Null,'Child 3'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(4); h1 := InsertItem(h,Null,'Child 4'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(9); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(4); ExpandItem[h] := True; end; EndUpdate(); end |
601 |
Is it is possible to have a column computing values from other columns
with Grid1 do begin BeginUpdate(); MarkSearchColumn := False; with Columns do begin Add('Name'); with (IUnknown(Add('A')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('B')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' +'''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 36; FormatColumn := 'len(value) ? value + '' ='''; Editor.EditType := EXGRIDLib_TLB.SpinType; end; with (IUnknown(Add('A+B+C')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortNumeric; AllowSizing := False; Width := 64; ComputedField := '%1+%2+%3'; FormatColumn := '((0:=dbl(value)) < 10? ''<fgcolor=808080><font ;7>'' :''<b>'') + currency(=:0)'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Root'); CellValueFormat[OleVariant(h),OleVariant(4)] := EXGRIDLib_TLB.exComputedField; h1 := InsertItem(h,Null,'Child 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(7); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(3); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(1); h1 := InsertItem(h,Null,'Child 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(5); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(12); h1 := InsertItem(h,Null,'Child 3'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(4); h1 := InsertItem(h,Null,'Child 4'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(9); CellValue[OleVariant(h1),OleVariant(3)] := OleVariant(4); ExpandItem[h] := True; end; EndUpdate(); end |